/**
 * Created by cj on 2017/5/2.
 */

var testModule = (function () {
    var counter = 0;
    return {
        incrementCounter: function () {
            return counter++;
        },
        resetCounter: function () {
            console.log("counter value prior to reset:" + counter);
            counter = 0;
        }
    };
})();
//使用：
//增加counter的值
testModule.incrementCounter();
//测试counter的值并重置,输出：1
testModule.resetCounter();

